Search
DateTimeSeries Constructor (List<Date> | Array<Date>, List<Number> | Array<Number>, Date, Date)
See Also
 






Initializes a new instance of the DateTimeSeries class.

Namespace: MindFusion.Charting
File: DateTimeSeries.js

 Syntax

JavaScript  Copy Code

function DateTimeSeries (dates, values, minDate, maxDate)

 Parameters

dates

A list of Date values.

values

A list of number values.

minDate

Identifies the start of the time range.

maxDate

Identifies the end of the time range.

 Example

The following code creates a new DateTimeSeries that uses the last 10 years as Date values and an array with income data. The first and last Date in the date array are used as min and max values.

JavaScript  Copy Code

// create a sample series
var years = [];
var dt = new Date(new Date().getFullYear() - 10, 11, 31);
for (; ;)
{
 if (dt.getFullYear() > new Date().getFullYear())
  break;
 years.push(new Date(dt.setFullYear(dt.getFullYear() + 1)));
}

var income = [12, 13.2, 15.6, 17.8, 39, 20, 29, 79, 101, 120, 122];

var series = new DateTimeSeries(
 years, income, years.item(0), years.item(years.count() - 1));

 See Also